package spring.my.db.sharding.demo.response;

import spring.my.db.sharding.demo.enums.BzStatus;

import java.io.Serializable;
import java.time.LocalDateTime;

public class Response implements Serializable {

    private int status;
    private String message;
    private LocalDateTime dateTime = LocalDateTime.now();

    public Response() {
    }

    public Response(int status, String message) {
        this.status = status;
        this.message = message;
    }

    public Response info(BzStatus status) {
        if (status != null) {
            setStatus(status.getCode());
            setMessage(status.getMessage());
        }
        return this;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }
}
